<?php
/**
 * +--------------------------------------------------------+
 * @Created by Phpstorm.
 * @Category InformationService.php
 * @Depiction
 * @Author hwy <429208948@qq.com>
 * @Date 2022/6/22  20:26
 * +--------------------------------------------------------+
 */

namespace App\Services;


use App\Repositories\CollectArticleRepository;

class InformationService extends BaseService
{
    protected $collectArticleRepository;

    public function __construct(CollectArticleRepository $collectArticleRepository)
    {
        $this->collectArticleRepository = $collectArticleRepository;
    }

    public function getNumber()
    {
        $all_number = $this->collectArticleRepository->getNumber();
        $hx_number  = $this->collectArticleRepository->getNumber(1);
        $k36_number = $this->collectArticleRepository->getNumber(2);
        $tmt_number = $this->collectArticleRepository->getNumber(3);

        return [
            '文章总数' => $all_number,
            '虎嗅'   => $hx_number,
            '36氪'  => $k36_number,
            '钛媒体'  => $tmt_number,
        ];
    }

    public function getList(array $params): array
    {
        $list = $this->collectArticleRepository->getList($params);

        $list = $this->initPaginateData($list);

        return $list;
    }

}
